package com.cheer.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.cheer.common.Page;
import com.cheer.dto.*;
import com.cheer.entity.MallOrderEntity;
import com.cheer.vo.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 订单表
 *
 * @author cheer
 */
public interface MallOrderService extends IService<MallOrderEntity> {

    /**
     * 分页查询订单
     */
    Page<MallOrderListVO> listByQueryCondition(MallOrderQueryDTO orderQueryDTO);

    /**
     * 查询订单详情
     */
    MallOrderInfoVO info(Long id);

    /**
     * 发货
     */
    void deliver(MallOrderDeliverDTO orderDeliverDTO, MallOrderEntity orderEntity);

    /**
     * 查看退款详情
     */
    MallRefundInfoVO getRefundInfo(Long id);

    /**
     * 退款
     */
    void agreeRefund(MallOrderEntity orderEntity);

    /**
     * 拒绝退款
     */
    void rejectRefund(MallOrderEntity orderEntity, String reply);

    /**
     * 查询商户已完成的订单，只返回订单商品金额和数量
     */
    List<MallOrderEntity> listFinishedSimplyByShopId(Long shopId);

    /**
     * 根据订单状态查询
     */
    List<MallOrderEntity> listByStatus(List<Integer> statusList);

    /**
     * 根据商户和订单状态查询
     */
    List<MallOrderEntity> listByShopIdAndStatus(Long shopId, List<Integer> statusList);

    /**
     * 根据电子券码查询商户
     */
    Long getShopIdByVirNumber(String virNumber);

    /**
     * 根据电子券码查询订单
     */
    MallOrderEntity getByVirNumber(String virNumber);

    /**
     * 创建订单
     */
    MallOrderCreateVO add(MallOrderAddDTO orderAddDTO, Integer userId, String openid, String ip);

    /**
     * 查询用户订单
     */
    List<MallOrderFrontListVO> listByUserId(Integer userId, Integer status);

    /**
     * 查询用户退换订单
     */
    List<MallOrderFrontListVO> listRefundByUserId(Integer userId);

    /**
     * 查询物流
     */
    MallExpressInfoVO getExpress(Long id);

    /**
     * 查询订单详情
     */
    MallOrderFrontInfoVO frontInfo(Long id);

    /**
     * 确认收货
     */
    void finish(Long id, Integer userId);

    /**
     * 申请退款
     */
    void refund(MallOrderRefundApplyDTO orderRefundApplyDTO, Integer userId);

    /**
     * 查看退款
     */
    MallRefundFrontInfoVO frontRefundInfo(Long id, Integer userId);

    /**
     * 查询用户订单简略信息
     */
    List<MallSimpleOrderVO> listSimplyByUserId(Integer userId);

    /**
     * 搜索订单
     */
    List<MallOrderFrontListVO> search(Integer userId, String keyword);

    /**
     * 查看订单电子券码
     */
    MallQrCodeVO getQrcode(Long id);

    /**
     * 订单号支付成功
     */
    void paySuccessByNumber(String number);

    /**
     * 查询订单支付状态
     */
    Integer getPayStatus(Long id, Integer userId);

    /**
     * 取消订单
     */
    void cancel(Long id, Integer userId);

    /**
     * 付款
     */
    MallOrderCreateVO pay(Long id, Integer userId, String openid, String ip);

    void download(MallOrderQueryDTO orderQueryDTO, HttpServletResponse response);

    void importOrder(MultipartFile file);

    void importOrderExpress(MultipartFile file);

    LotteryVO startLottery(Integer userId);

    LotteryVO award(Integer userId);

    List<String> getLotteryAnnouncement();
}

